home *** CD-ROM | disk | FTP | other *** search
- /* $VER: SpYam-O-Matic.yam 0.1 (13.7.97)
- *
- * To be used from YAM
- *
- * Forwards the current message to several "interested" parties.
- *
- * PLEASE don't use this as a toy!
- * The only way our concerns will be taken seriously is if WE take
- * them seriously.
- *
- * Concept & Original Script by: Kirk Strauser <kstrauser@gxl.com>
- * Re-written by: Adrian Knight <ajk@dial.pipex.com>
- * Kirk Strauser <kstrauser@gxl.com>
- *
- * Modified for use from YAM by GĂ©rard Cornu (13-Jul-97 ;-)
- *
- * Need Amigados command 'join' in path, rexxsupport.library in libs:.
- *
- */
-
- YAM_port = 'YAM'
- YAM_SOM_dir = 'YAM:rexx/SpYam-O-Matic/'
- somcfg = YAM_SOM_dir || 'SpYam.Cfg'
- final_file = 'T:SpYam.temp2'
-
- lib = 'rexxsupport.library'
- if ~show('L',lib) then if ~addlib(lib, 0, -30) then call my_exit('I need 'lib)
-
- options results
- options failat 31
-
- address(YAM_port)
-
- getmailinfo FROM
- from = result
- if(rc ~= 0) then call my_exit('No current message.')
-
- getmailinfo file
- msg_file = result
- if(rc ~= 0) then my_exit('Unable to get current message file.')
-
- parse var from user'@'domain
- domain = strip(domain, 'T', '>')
- if domain = '' then my_exit('Unable to find senders domain name')
- user = strip(word(user, words(user)), 'L', '<')
-
- address command 'join 'YAM_SOM_dir'SpYamHeader 'msg_file' 'YAM_SOM_dir'SpYamFooter as 'final_file
- if (rc ~= 0) then my_exit('Unable to build message file.')
-
- if exists(somcfg) then do
- open(cfg, somcfg, 'R')
- tname = user', Postmaster'
- to_address = user'@'domain' postmaster@'domain
- msgtit = '"Usenet spam/mail fraud"'
- do until eof(cfg)
- line = readln(cfg)
- if (left(line,1) ~= '#') & (line ~= '') then do
- parse var line name ',' address
- tname = tname || ', ' || name
- to_address = to_address || ' ' || address
- end
- end
- call close(cfg)
- end
- else my_exit('Unable to locate config file.')
-
- 'mailwrite'
- 'writemailto' to_address
- 'writesubject' msgtit
- 'writeletter' final_file
-
- 'request' '"Should this message be?" "Sent|Queued"'
- action = result
- if action = 1 then 'writesend'
- else 'writequeue'
-
- address command 'delete <>nil: 'final_file
-
- exit
-
- /**************************************************
- */
- my_exit: procedure expose final_file YAM_port
-
- parse arg text
-
- address(YAM_port)
- 'request' '"'text'"' 'Oops!'
- if exists(final_file) then address command 'delete <>NIL: 'final_file
-
- exit
-